/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.expert.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.chlitina.store.common.config.Global;
import com.chlitina.store.common.persistence.Page;
import com.chlitina.store.common.web.BaseController;
import com.chlitina.store.modules.expert.entity.SolutionFaceAndProduct;
import com.chlitina.store.modules.expert.service.SolutionFaceAndProductService;
import com.chlitina.store.modules.expert.service.SolutionFaceService;


/**
 * 面部护理方案与产品关系Controller
 * @author lvbo
 * @version 2013-06-08
 */
@Controller
@RequestMapping(value = Global.ADMIN_PATH+"/expert/solutionFaceAndProduct")
public class SolutionFaceAndProductController extends BaseController {

	@Autowired
	private SolutionFaceAndProductService solutionFaceAndProductService;
	
	@Autowired
	private SolutionFaceService solutionFaceService;

	@ModelAttribute
	public SolutionFaceAndProduct get(@RequestParam(required=false) Long id) {
		return new SolutionFaceAndProduct();
	}

	@RequestMapping(value = "listDetail")
	public String listDetail(Long solutionId, SolutionFaceAndProduct solutionFaceAndProduct, HttpServletRequest request, HttpServletResponse response, Model model) {
		if (solutionId != null) {
			Page<SolutionFaceAndProduct> page = solutionFaceAndProductService.find(new Page<SolutionFaceAndProduct>(request, response), solutionFaceAndProduct, solutionId); 
			model.addAttribute("solutionFace", solutionFaceService.get(solutionId));
			model.addAttribute("page", page);
		}
		return "modules/expert/solutionFaceAndProductListDetail";
	}
}
